package com.huluobo.lc.kotlinim1807ak.adapter

import android.content.Context
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.huluobo.lc.kotlinim1807ak.data.AddFriendItem
import com.huluobo.lc.kotlinim1807ak.widget.AddFriendListItemView

/**
 * @author Lc
 * @description:
 * @date :2021/3/3 10:31
 */
class AddFriendAdapter(val context: Context, private val addFriendItems: MutableList<AddFriendItem>) :
    RecyclerView.Adapter<RecyclerView.ViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        return AddFriendListItemViewHolder(AddFriendListItemView(context))
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        val addFriendListItemView = holder.itemView as AddFriendListItemView
        addFriendListItemView.bindView(addFriendItems[position])
    }

    override fun getItemCount(): Int = addFriendItems.size

    class AddFriendListItemViewHolder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) {

    }
}